﻿@using SCMS.Resource
@model IEnumerable<SCMS.UI.Models.WRNItems>
@Ajax.ActionLink(Resources.Global_String_AddItem, "Index", new { id = "NewItem" }, new AjaxOptions
{
    OnBegin = string.Format("ShowDialogue('{0}')", Resources.Global_String_AddItem),
    UpdateTargetId = "popup-page",
    LoadingElementId = "popup-loading",
    Url = Url.Action("NewItem/" + @ViewBag.WRNId),
    OnSuccess = "CenterPopup"
})

<div class="partialViewCard">
    <div class="partialViewCardHeader">
        <h3>
            @Resources.WRForm_LoadWRItems_WRItems</h3>
    </div>
    <br />
    <input type="hidden" id="actionStatus" value="@ViewBag.Response" />
    <input type="hidden" id="statusMsg" value="@ViewBag.msg" />
    @if (Model.Count() > 0)
    {
        <table width="98%" align="center" class="cardTable" cellspacing="0" cellpadding="0"
            border="1">
            <tr class="gridheader">
                <th>
                    @Resources.WRForm_LoadWRF_ItemGoodsDescription
                </th>
                <th>
                    @Resources.Global_String_UnitMessure
                </th>
                <th>
                    @Resources.Global_String_SerialNo
                </th>
                <th>
                    @Resources.Global_String_AssetNo
                </th>
                <th>
                    @Resources.Global_String_Quantity
                </th>
                <th>
                    @Resources.Global_String_Comments
                </th>
                <th>
                    @Resources.Global_String_Manage
                </th>
            </tr>
            @{ string itemName, serialNo, assetNo; }
            @foreach (var item in Model)
            {
                if (item.EntityWhouseRItem.Inventory.Item.ItemCategory.CategoryCode == "C")
                {
                    itemName = item.EntityWhouseRItem.Inventory.Item.Name;
                    serialNo = item.EntityWhouseRItem.Inventory.Item.SerialNumber;
                    assetNo = Resources.Global_String_NA;
                }
                else
                {
                    itemName = item.EntityWhouseRItem.Asset.Name;
                    serialNo = item.EntityWhouseRItem.Asset.SerialNumber;
                    assetNo = item.EntityWhouseRItem.Asset.AssetNumber;
                }
                    
                <tr class="gridodd">
                    <td>
                        @itemName
                    </td>
                    <td align="center">
                        @item.EntityWhouseRItem.Inventory.Item.UnitOfMeasure.Code
                    </td>
                    <td align="center">
                        @serialNo
                    </td>
                    <td align="left">
                        @assetNo
                    </td>
                    <td align="center">
                        @item.EntityWhouseRItem.Quantity
                    </td>
                    <td align="left">
                        @item.EntityWhouseRItem.Comments
                    </td>
                    <td>
                        @*   @Ajax.ActionLink("Edit", "Index", new { id = "EditItem" }, new AjaxOptions
                        {
                            OnBegin = "ShowDialogue('Edit OR Item')",
                            UpdateTargetId = "popup-page",
                            LoadingElementId = "popup-loading",
                            Url = Url.Action("EditItem/" + item.EntityOrderRequestItem.Id),
                            OnSuccess = "CenterPopupPO"
                        })*@
                    </td>
                </tr>
            }
        </table>
    }
    <br />
    &nbsp;&nbsp;&nbsp;
    <input type="button" class="btn green" value=" @Resources.Global_String_SubmitForApproval " onclick="sendRequest('SubmitWRN/@ViewBag.WRNId', 'wrfDiv', 'loading'); document.getElementById('wrfItemDiv').innerHTML='';" />
    <br />
</div>
